using Common.Commands;
using Common.Commands.LeadCommands;
using Core.Domain.Model;
using Sanelib.DataOperation;
using Sanelib.Dto;

namespace Core.Processors.LeadsProcessors
{
	public class DeleteLeadsProcessor : ICommandProcessor<DeleteLead>
	{
		private readonly IRepository<Lead> _leadsRepository;

		public DeleteLeadsProcessor(IRepository<Lead> leadsRepository)
		{
			_leadsRepository = leadsRepository;
		}

		public dynamic Process(DeleteLead command)
 		{
			var response = new WebApiResultResponse();

			var leads = _leadsRepository.GetById(command.Id);

			_leadsRepository.Delete(leads.Id);
			response.IsSuccess = true;

			return response;
		}
	}
}
